cmake_minimum_required(VERSION 2.8.12)

project(CheckOBJCCompilerFlag)

include(CheckOBJCCompilerFlag)

if(CMAKE_COMPILER_IS_GNUOBJC)
  set(COMPILER_FLAG -fobjc-direct-dispatch)
else()
  set(COMPILER_FLAG -fobjc-gc)
endif()

CHECK_OBJC_COMPILER_FLAGS(${COMPILER_FLAG} HAS_COMPILER_FLAG)

if(NOT HAS_COMPILER_FLAG)
  message(SEND_ERROR "Test fail: HAS_COMPILER_FLAG: ${COMPILER_FLAG}")
endif
